﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Workflow;

namespace WorkflowStarter
{
    public static class Extensions
    {
        public static SPWorkflow GetById(this SPWorkflowCollection collection, Guid id)
        {
            
            SPWorkflow result = null;
            foreach (SPWorkflow workflow in collection)
            {
                if (workflow.ParentAssociation.Id == id)
                {
                    result = workflow;
                }
            }

            return result;
        }
    }
}
